package database
import (
	"fmt"
	"gorm.io/driver/postgres"
	"project/app/model"
	"net/http"
	"strconv"
	"github.com/gin-gonic/gin"
	"gorm.io/gorm"
)
var DB *gorm.DB

// 连接数据库
func InitDB() *grom.DB {
	dsn: = "host=localhost user=postgres password=123456 dbname=system port=5432"
	db, err := grom.Open(postgres.Open(dsn), &gorm.Config{})
	if err != nil {		//连接数据库失败
		panic(err.Error())
	}
	DB = db
	return db
}

func GetDB() *grom.DB {
	return db
}
